package gson;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import bean.User;
import bean.UserWithBirthday;
import json.ReadJson;

public class readGson { 
   public static void main(String[] args) throws IOException {
	   File file=new File(ReadJson.class.getResource("/BenWithBirthday.json").getFile());
	   String content=FileUtils.readFileToString(file);
	   Gson gson=new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
	   UserWithBirthday user=gson.fromJson(content, UserWithBirthday.class);
	   System.out.println(user.getBirthday().toLocaleString());
} 
}
